<?php
require_once '../sub/init.php';
if(@!in_array('hn',$navarr))exit('该功能已关闭');
if(!is_mobile())header("Location: ".Href('hongniang'));
require_once ZEAI.'sub/conn.php';
require_once ZEAI.'cache/udata.php';
require_once ZEAI.'cache/config_index.php';
$t = ($t=='hnlist' || $t=='hndetail')?$t:'';
$jumpurl=a('{"kind":"hongniang"}');
$nodatatips="<div class='nodatatips'><i class='ico'>&#xe608;</i>暂时木有内容</div>";
//门店
if(!empty($AGT)){
	$agentSQL2=" AND b.agentid=".$AGT['agentid'];
	if(!empty($AGT['sitetitle']))$_INDEX['indexTitle']= trimhtml($AGT['sitetitle']);
}
//门店结束
if($t=='hnlist'){
	function rows_ulist($rows,$p,$i) {
		global $_ZEAI;
		$id       = $rows['id'];
		$sex      = $rows['sex'];
		$truename = dataIO($rows['truename'],'out',7);
		$path_s   = $rows['path_s'];
		$title    = dataIO($rows['title'],'out');
		$href     = 'hongniang.php?hid='.$id;
		$sex_title= ($sex == 2)?'她':'他';
		$path_s_url = (!empty($path_s))?UP.smb($path_s,'b'):RES.'photo_m'.$sex.'.png';
		$O  = '<a class="li" href="'.$href.'"><img src="'.$path_s_url.'">';
		$O .= '<h2>'.$truename.'</h2>';
		$O .= '<h4>'.$title.'</h4>';
		$O .= '<span class="add"><i class="ico">&#xe622;</i>找'.$sex_title.'牵线</span></a>';
		if($i % 2 == 0)$O .= '<div class="clear"></div>';
		return $O;
	}

	$_ZEAI['pagesize'] = 4;
	$ZEAI_SQL = "ifwebshow=1 AND flag=1 AND path_s<>''".$agentSQL;
	$ZEAI_SELECT="SELECT id,sex,truename,path_s,title FROM ".__TBL_CRM_HN__." WHERE  ".$ZEAI_SQL." ORDER BY px DESC,id DESC";
	if($submitok=='ZEAI_list'){exit(Zeai_ajax_list_fn($ZEAI_totalP,$p));}
	$ZEAI_total = $db->COUNT(__TBL_CRM_HN__,$ZEAI_SQL);
	$ZEAI_totalP= ceil($ZEAI_total/$_ZEAI['pagesize']);
}
if(ifint($hid)){
	if(!is_mobile())header("Location: ".Href('hongniang_detail',$hid));
	$row = $db->ROW(__TBL_CRM_HN__,"qq,weixin,mob,path_s,ewm,truename,sex,aboutus,title,pj_good,pj_normal,pj_bad,click,agenttitle","flag=1 AND id=".$hid,"name");
	if ($row){
		$truename = trimhtml(dataIO($row['truename'],'out',7));
		$aboutus  = dataIO($row['aboutus'],'out');
		$title    = trimhtml(dataIO($row['title'],'out'));
		$agenttitle= dataIO($row['agenttitle'],'out');
		$pj_good  = $row['pj_good'];
		$pj_normal= $row['pj_normal'];
		$pj_bad   = $row['pj_bad'];
		$unum     = $row['unum'];
		$bbsnum   = $row['bbsnum'];
		$click    = $row['click'];
		$sex      = $row['sex'];
		$path_s   = $row['path_s'];
		$ewm      = $row['ewm'];
		$qq = dataIO($row['qq'],'out');
		$weixin = dataIO($row['weixin'],'out');
		$mob = dataIO($row['mob'],'out');
		//
		$sex_title= ($sex == 2)?'她':'他';
		$path_s_url = (!empty($path_s))?UP.$path_s:RES.'photo_m'.$sex.'.png';
		$ewm_url    = (!empty($ewm))?UP.$ewm:RES.'photo_m'.$sex.'.png';
		$sexbg   = (empty($path_s))?' class="sexbg'.$sex.'"':'';
		$join_title = '～ 找'.$sex_title.'牵线 ～';	
		$db->query("UPDATE ".__TBL_CRM_HN__." SET click=click+1 WHERE id=".$hid);
		//$unum = $db->COUNT(__TBL_USER__,"admid=".$hid);
	}else{
		if($js==1){
			json_exit(array('flag'=>0,'msg'=>'红娘信息不存在'));
		}else{
			zeaialert('{"title":"信息不存在","btnt":"我知道了","url":"-1"}');	
		}
	}
}
if($submitok == 'ajax_hnBBS_update'){
	if(!ifint($hid))json_exit(array('flag'=>0,'msg'=>'红娘ID错误'));
	if ($cook_content == $content && !empty($content))json_exit(array('flag'=>0,'msg'=>'请不要重复发布'));
	if(!iflogin()){
		$jumpurl=a('{"kind":"hongniang","id":"'.$hid.'"}');
		json_exit(array('flag'=>'nologin','jumpurl'=>$jumpurl));
	}
	//
	if ( (str_len($content)>10000 || str_len($content)<1) )json_exit(array('flag'=>0,'msg'=>'评价内容请控制在1~1000字节以内'));
	if ($kind != 1 && $kind != 2 && $kind != 3)json_exit(array('flag'=>0,'msg'=>'请打分【好评－中评－差评】'));
	switch ($kind) {
		case 1:$sql  = " ,pj_good=pj_good+1 ";break;
		case 2:$sql  = " ,pj_normal=pj_normal+1 ";break;
		case 3:$sql  = " ,pj_bad=pj_bad+1 ";break;
	}
	$row = $db->ROW(__TBL_HN_BBS__,"id","uid=".$cook_uid." AND hid=".$hid);
	if ($row)json_exit(array('flag'=>0,'msg'=>'您已经评价过了～请不要重复评价'));
	$row = $db->ROW(__TBL_USER__,"crm_flag","id=".$cook_uid." AND admid=".$hid,"name");
	if ($row){
		$crm_flag = $row['crm_flag'];
		if($crm_flag<1)json_exit(array('flag'=>0,'msg'=>'您刚被Ta分配，即将为您服务！暂时无法评价哦'));
		$content = dataIO(trimhtml($content),'in',1000);
		$db->query("INSERT INTO ".__TBL_HN_BBS__." (uid,hid,content,addtime,pjkind) VALUES ($cook_uid,'$hid','$content',".ADDTIME.",$kind)");
		$bbsnum = $db->COUNT(__TBL_HN_BBS__,"hid=".$hid);
		$db->query("UPDATE ".__TBL_CRM_HN__." SET bbsnum=$bbsnum ".$sql." WHERE id=".$hid);
		setcookie("cook_content",$content,time()+720000,"/",$_ZEAI['CookDomain']);
		json_exit(array('flag'=>1,'msg'=>'评价成功，非常感谢您的参与'));
	}else{
		json_exit(array('flag'=>0,'msg'=>'您没有找Ta牵线，无法评价哦'));
	}
}elseif($submitok == 'ajax_join_update'){
	if(!ifint($hid))json_exit(array('flag'=>0,'msg'=>'红娘ID错误'));
	if(!iflogin()){
		$jumpurl=a('{"kind":"hongniang","id":"'.$hid.'"}');
		json_exit(array('flag'=>'nologin','jumpurl'=>$jumpurl));
	}
	//当前红娘
	$rowf = $db->ROW(__TBL_CRM_HN__,"id,truename,agentid,agenttitle,openid,subscribe","ifwebshow=1 AND flag=1 AND id=".$hid,'name');
	if (!$rowf)json_exit(array('flag'=>0,'msg'=>'红娘不存在'));
	$hn_truename   = dataIO($rowf['truename'],'out');
	$hn_agentid    = intval($rowf['agentid']);
	$hn_agenttitle = $rowf['agenttitle'];
	$hn_openid     =  $rowf['openid'];
	$hn_subscribe  =  $rowf['subscribe'];
	//我
	$row2 = $db->ROW(__TBL_USER__,"nickname,sex,admid,admname","id=".$cook_uid,"name");
	if ($row2){
		$cook_nickname= trimhtml(dataIO($row2['nickname'],'out'));
		$cook_admid   = intval($row2['admid']);
		$cook_sex     = intval($row2['sex']);
		$cook_admname = dataIO($row2['admname'],'out');
		if($cook_admid>0)json_exit(array('flag'=>0,'msg'=>'您已经被红娘【'.$cook_admname.' -> ID:'.$cook_admid.'】接洽，正在服务中'));
		$db->query("UPDATE ".__TBL_USER__." SET admid=".$hid.",admname='$hn_truename',admtime=".ADDTIME.",agentid=".$hn_agentid.",agenttitle='$hn_agenttitle' WHERE (flag=1 OR flag=-2) AND id=".$cook_uid);
		//通知红娘
		$sex_title = ($cook_sex == 1)?'他':'她';
		$T = '【'.$cook_nickname.' uid:'.$cook_uid.'】想委托您为'.$sex_title.'服务';
		$C = $T.'，已经在你名下，成为了您的客户，请到CRM后台进行联系跟进服务';
		//$db->SendTip($hn_uid,$T,dataIO($C,'in'),'sys');
		//微信通知
		if ($hn_subscribe == 1 && !empty($hn_openid)){
			//客服通知
			$content = urlencode($C);
			$ret = @wx_kf_sent($hn_openid,$content,'text');
			$ret = json_decode($ret);
			//模版通知
			if ($ret->errmsg != 'ok'){
				$keyword1  = $content;
				$keyword3  = urlencode($_ZEAI['siteName']);
				@wx_mb_sent('mbbh=ZEAI_ADMIN_INFO&openid='.$hn_openid.'&keyword1='.$keyword1.'&keyword3='.$keyword3.'&time='.ADDTIME.'&first='.$first.'&remark='.$remark.'&url=');
			}
		}
	}
	json_exit(array('flag'=>1,'msg'=>'申请已发送，请等待【'.$hn_truename.'】接洽～'));
}
if(ifint($hid)){
	///$mini_title=$truename;
	$bodytitle = $truename.'-'.$title;
}elseif($t=='hnlist'){
	$bodytitle ='红娘团队';
	$mini_title='红娘团队';
}else{
	$bodytitle ='线下红娘一对一服务';
	$mini_title='线下一对一服务';
}
$kf_wxpic=dataIO($_ZEAI['kf_wxpic'],'out');
$nav='hn';
?>
<!doctype html><html><head><meta charset="utf-8">
<title><?php echo $bodytitle.'-'.$_ZEAI['siteName'];?></title>
<?php echo HEADMETA; ?>
<link href="<?php echo RES;?>m/css/m.css?<?php echo $_ZEAI['cache_str'];?>" rel="stylesheet" type="text/css" />
<link href="<?php echo HOST;?>/cache/zeaicolor.css?<?php echo $_ZEAI['cache_str'];?>" rel="stylesheet" type="text/css" />
<link href="<?php echo RES;?>m/css/hongniang.css?<?php echo $_ZEAI['cache_str'];?>" rel="stylesheet" type="text/css" />
<script src="<?php echo RES;?>www_zeai_cn.js?<?php echo $_ZEAI['cache_str'];?>"></script>
<script src="<?php echo RES;?>m/js/m.js?<?php echo $_ZEAI['cache_str'];?>"></script>
<style>
body{background-color:#fff}
.btmKefuBtn,.hnlist .add,.hn_i_box .iubtn a.ed,.hn_i_box h1 b,
.hn_i_btm a:last-child span,.hid_top:after{background-color:<?php echo $_ZEAI['mob_mbcolor'];?>}
a.hn_i_more{border-color:<?php echo $_ZEAI['mob_mbcolor'];?>;color:<?php echo $_ZEAI['mob_mbcolor'];?>}
.hn_i_btm a,.iMarquee li i,#backtop a{color:<?php echo $_ZEAI['mob_mbcolor'];?>}
</style>
<?php
if (is_weixin()){
	require_once ZEAI."api/weixin/jssdk.php";?>
	<script src="<?php echo RES; ?>jweixin-1.2.0.js"></script>
<?php }?>
</head>
<body>
<?php if ($_ZEAI['m_mb']==2 && !ifint($hid)){$TRnav_btn = 'hide';$mainstyle='';require_once ZEAI.'m/top2.php';}else{
	$mini_class='top_mini4 zeaibg bgcolor';
	require_once ZEAI.'m/top_mini.php';
}
/**********红娘正文**********/
if(ifint($hid)){
$wxshareT   = $truename.' - '.$title;
$wxshareC   = $aboutus;
$wxshareURL = HOST.'/m/hongniang.php?hid='.$hid;
$wxsharePIC = $path_s_url;?>
<div class="hid_top">
	<img src="<?php echo $path_s_url;?>" class="logo">
    <div class="hid">工号：<?php echo $hid;?></div>
	<div class="truename "><h2><?php echo $truename;?></h2><span><?php echo $agenttitle;?></span><div class="title "><?php echo $title;?></div></div>
    <div class="myb">
        <a href="#content"><b><?php echo $click; ?></b><span>人气</span></a>
        <a href="#content"><b><?php echo $pj_good; ?></b><span>好评</span></a>
        <a href="#content"><b><?php echo $pj_normal; ?></b><span>中评</span></a>
        <a href="#content"><b><?php echo $pj_bad; ?></b><span>差评</span></a>
    </div>
</div>
<div class="aboutus"><?php echo $aboutus;?></div>
<!--<div class="uline"></div>-->
<div class="hn_i_box hn_hid_box">
	<h1>联系红娘<b></b></h1>
    <div class="detaicotact">
        <?php if (!empty($mob)){ ?><li><p class="ico telico">&#xe7c1;</p>红娘热线 <span><?php echo $mob; ?></span><a href="tel:<?php echo $mob; ?>">拔打</a></li><?php }?>
        <?php if (!empty($qq)){ ?><li><p class="ico qqico">&#xe623;</p>红娘QQ <span><?php echo $qq; ?></span></li><?php }?>
        <?php if (!empty($weixin)){ ?><li><p class="ico wxico">&#xe607;</p>红娘微信 <span><?php echo $weixin; ?></span></li><?php }?>
        <a name="bbs"></a>
        <?php if (!empty($ewm)){ ?>
        <div class="hnewm"><img src="<?php echo $ewm_url; ?>"><h6>长按二维码加红娘微信</h6></div>
        <?php }?>
    </div>
</div>
<div class="uline"></div>
<div class="hn_i_box hn_hid_box">
	<h1>服务评价<b></b></h1>
    <!-- 留言开始 -->
    <div class="detaibbs">
        <div id="hn_bbs_listbox">
            <?php
            $rt=$db->query("SELECT a.nickname,a.sex,a.grade,a.photo_s,a.photo_f,a.photo_ifshow,a.flag AS Uflag,b.* FROM ".__TBL_USER__." a,".__TBL_HN_BBS__." b WHERE (a.flag=1 OR a.flag=-2) AND a.id=b.uid AND b.hid=".$hid." ORDER BY b.id");
            $total = $db->num_rows($rt);
            if($total>0){
            for($i=1;$i<=$total;$i++) {
                $rows = $db->fetch_array($rt,'name');
                if(!$rows) break;
                $sex           = $rows['sex'];
                $grade         = $rows['grade'];
                $nickname      = trimhtml(dataIO($rows['nickname'],'out'));
                $photo_s       = $rows['photo_s'];
                $photo_f       = $rows['photo_f'];
				$Uflag         = $rows['Uflag'];
                $photo_ifshow  = $rows['photo_ifshow'];
                $photo_s_url   = (!empty($photo_s) && $photo_f==1)?UP.$photo_s:RES.'photo_m'.$sex.'.png';
                $content       = trimhtml(dataIO($rows['content'],'out'));
                $content2      = dataIO($rows['content2'],'out');
                $content2_str  = (!empty($content2))?'<div class="hnhf">红娘回复：'.$content2.'</div>':'';
                $flag          = $rows['flag'];
                $pjkind        = $rows['pjkind'];
                switch ($pjkind){
                    case 1:$pjkind_t = '<span class="pjkind k1">好评</span>';break;
                    case 2:$pjkind_t = '<span class="pjkind k2">中评</span>';break;
                    case 3:$pjkind_t = '<span class="pjkind k3">差评</span>';break;
                }
				if($photo_ifshow==0 || $Uflag==-2){$photo_s_url=RES.'photo_m'.$sex.'_hide.png';$nickname='***';}
            ?>
            <table class="table li"><tr><td valign="top" class="liL"><img src="<?php echo $photo_s_url; ?>"></td>
            <td valign="top" class="liR">
            <table class="table nickname"><tr>
            <td align="left" class="S12"><?php echo $flag.$nickname; ?>　<?php echo date_str($rows['addtime']); ?>评价</td>
            <td align="right" class="lou"><span><?php echo $i;?></span>楼</td>
            </tr></table>
            <div class="C"><?php echo $pjkind_t;if ($flag == 1){echo $content.$content2_str;}else{echo'<font>该评价已被冻结或删除！</font>';}?></div>
            </td></tr></table>
            <?php }}else{echo "<div class='nodatatips'><i class='ico'>&#xe659;</i>暂时木有服务评价</div>";} ?>  
        </div>
        <form id="WwW_Zeai_CN_hnBBS" class="bmform">
        <textarea id="content" name="content" placeholder="我想说两句...请如实评价~~" ></textarea>
        <div class="pjform">服务打分：
            <input type="radio" name="kind" id="kind1" class="radioskin" value="1"><label for="kind1" class="radioskin-label"><i class="i1"></i><b>好评</b></label>
            <input type="radio" name="kind" id="kind2" class="radioskin" value="2"><label for="kind2" class="radioskin-label"><i class="i1"></i><b>中评</b></label>
            <input type="radio" name="kind" id="kind3" class="radioskin" value="3"><label for="kind3" class="radioskin-label"><i class="i1"></i><b>差评</b></label>
        </div>
        <a name="anli"></a>
        <input type="button" class="btn size3 zeaibg" value=" 发表评价 " id="hn_bbs_btn" />
        <input type="hidden" name="hid" id="hid" value="<?php echo $hid; ?>">
        <input type="hidden" name="i" value="<?php echo $total; ?>">
        <input type="hidden" name="submitok" value="ajax_hnBBS_update">        
        </form>
        <script>
        hn_bbs_btn.onclick=function(){
            ZeaiM.confirmUp({title:'您只有一次评价机会～确定么？',cancel:'取消',ok:'确定',okfn:function(){
                if(zeai.str_len(content.value)<1 || zeai.str_len(content.value)>1000){
                    zeai.msg('评价内容请控制在1~1000字节！',content);
                    return false;
                }
                if (!zeai.form.ifradio('kind')){zeai.msg('请给红娘服务打分【好评－中评－差评】');return false;}
                zeai.ajax({url:HOST+'/m/hongniang'+zeai.extname,js:1,form:WwW_Zeai_CN_hnBBS},function(e){var rs=zeai.jsoneval(e);
                    zeai.msg(rs.msg,{time:3});
                    if(rs.flag==1){setTimeout(function(){location.reload(true);},3000);}
            });}});	
            
        }
        </script>
    </div>
    <!-- 留言结束 -->
</div>
<div class="uline"></div>
<div class="hn_i_box hn_hid_box">
	<h1>服务案例<b></b></h1>
    <div class="detaiuser">
        <ul id="hn_userbox">
            <?php
            $rt=$db->query("SELECT id,nickname,sex,photo_s,photo_f,birthday,flag,photo_ifshow FROM ".__TBL_USER__." WHERE (flag=1 OR flag=-2) AND admid=".$hid." AND kind<>4 ORDER BY refresh_time DESC LIMIT 100");
            $total = $db->num_rows($rt);
            if ($total > 0) {
                for($i=1;$i<=$total;$i++) {
                $rows = $db->fetch_array($rt,'name');
                if(!$rows) break;
                $uid      = $rows['id'];
                $nickname = trimhtml(dataIO($rows['nickname'],'out'));
                $sex      = $rows['sex'];
                $photo_s  = $rows['photo_s'];
                $photo_f  = $rows['photo_f'];
                $birthday = $rows['birthday'];
				$flag     = $rows['flag'];
                $photo_ifshow = $rows['photo_ifshow'];
                $birthday_str = (getage($birthday)<=0)?'':' '.getage($birthday).'岁';
                $photo_s_url = (!empty($photo_s) && $photo_f==1)?UP.$photo_s:RES.'photo_m'.$sex.'.png';
				if($photo_ifshow==0 || $flag==-2 || ifmLockBlur()){$photo_s_url=RES.'photo_m'.$sex.'_hide.png';}
				if($flag==-2)$nickname='***';
                $img_str     = '<img src="'.$photo_s_url.'">';
                ?>
                <li><a><?php echo $img_str; ?><h5><?php echo $nickname.$birthday_str; ?></h5></a></li>
            <?php }}else{echo "<div class='nodatatips'><i class='ico'>&#xe659;</i>暂时还木有人找".$sex_title."服务</div>";}?>
        </ul>
    </div>        
</div>
<?php
$hn_join_btnT='<span class="ico">&#xe635; 找'.$sex_title.'牵线</span>';
$hn_join_btnCls='';
if(ifint($cook_uid)){
	$row = $db->ROW(__TBL_USER__,"admid,admname","id=".$cook_uid,"name");
	if ($row){
		$cook_admid = intval($row['admid']);
		if($cook_admid==$hid){
			$hn_join_btnT='<span class="ico">&#xe643; 服务中</span>';
			$hn_join_btnCls=' class="doing"';
		}
	}
}?>
<div class="hn_i_btm ">
    <a href="#bbs"><i class="ico">&#xe629;</i><span>红娘评价</span></a>
    <a href="#anli"><i class="ico">&#xe617;</i><span>服务案例</span></a>
    <a id="hn_join_btn"<?php echo $hn_join_btnCls;?>><?php echo $hn_join_btnT;?></a>
</div>
<script>
hn_join_btn.onclick=function(){hn_join_btnFn();}
function hn_join_btnFn(){
	ZeaiM.confirmUp({title:'确定【<?php echo $truename;?>】为您服务么？选定后将不能更换',cancel:'取消',ok:'确定',okfn:function(){
	zeai.ajax({url:HOST+'/m/hongniang'+zeai.extname,js:1,data:{submitok:'ajax_join_update',hid:<?php echo $hid;?>}},function(e){var rs=zeai.jsoneval(e);
		zeai.msg(rs.msg,{time:3});
		if(rs.flag==1){setTimeout(function(){location.reload(true);},3000);}
	});}});	
}
</script>
<?php
/**********红娘列表**********/
}elseif($t=='hnlist'){?>
	<div class="hn_i_bnr"><img src="<?php echo RES.'m/img/hn_1.jpg';?>"<?php echo $mainstyle;?>></div>
    <div class="hn_i_box hnlistmore">
        <h1>专业红娘团队<b></b></h1>
        <h5>一对一会员服务，提供恋爱、婚姻、个人提升等全方位情感咨询服务</h5>
        <div class="hnlist" id="ZEAI_list"><?php if($ZEAI_totalP>0){echo Zeai_ajax_list_fn($ZEAI_totalP,$p);}else{echo $nodatatips;}?></div>
        <div class="clear"></div>
    </div>
    <?php if ($ZEAI_total > $_ZEAI['pagesize']){?>
		<script>
        var ZEAI_totalP = parseInt(<?php echo $ZEAI_totalP; ?>),p=2;
        zeaiOnscroll_json={url:'hongniang'+zeai.extname,data:{submitok:'ZEAI_list',ZEAI_totalP:ZEAI_totalP,t:'<?php echo $t;?>'}};
        document.body.onscroll = zeaiOnscroll;
        </script>
        <div id="backtop"><a href="#top" id="btmTopBtn"><i class="ico">&#xe60c;</i>顶部</a></div>
	<?php }
}else{/**********首页**********/
	$wxshareT   = $bodytitle;
	$wxshareC   = $bodytitle;
	$wxshareURL = HOST.'/m/hongniang.php?hid='.$hid;
	$wxsharePIC = RES.'m/img/hnico.jpg?'.$_ZEAI['cache_str'];?>
    <div class="hn_i_bnr"><img src="<?php echo RES.'m/img/hn_1.jpg';?>"<?php echo $mainstyle;?>></div>
    <div class="clear"></div>
    <div class="hn_i_box hnlist">
        <h1>专业红娘团队<b></b></h1>
        <h5>一对一会员服务，提供恋爱、婚姻、个人提升等全方位情感咨询服务</h5>
        <div id="list">
            <?php 
            $rt=$db->query("SELECT id,sex,truename,path_s,title FROM ".__TBL_CRM_HN__." WHERE ifwebshow=1 AND flag=1 AND path_s<>'' ".$agentSQL." ORDER BY px DESC LIMIT 4");
            $total = $db->num_rows($rt);
            if ($total > 0) {
                for($i=1;$i<=$total;$i++) {
                    $rows = $db->fetch_array($rt,'name');
                    if(!$rows)break;
                    $id       = $rows['id'];
                    $sex      = $rows['sex'];
                    $truename = dataIO($rows['truename'],'out',7);
                    $path_s   = $rows['path_s'];
                    $title    = dataIO($rows['title'],'out');
                    $href     = 'hongniang.php?hid='.$id;
					$sex_titlee= ($sex == 2)?'她':'他';
                    $path_s_url = (!empty($path_s))?UP.smb($path_s,'b'):RES.'photo_m'.$sex.'.png';?>
                    <a class="li" href="<?php echo $href;?>"><img src="<?php echo $path_s_url; ?>">
                        <h2><?php echo $truename; ?></h2>
                        <h4><?php echo (empty($title))?'　':$title; ?></h4>
                        <span class="add"><i class="ico">&#xe622;</i>找<?php echo $sex_titlee;?>牵线</span>
                    </a>
                    <?php
                    if($i % 2 == 0)echo '<div class="clear"></div>';
                    }}else{echo $nodatatips;}?>
        </div>
        <div class="clear"></div>
        <a href="hongniang.php?t=hnlist" class="hn_i_more">更多红娘</a>
        <div class="clear"></div>
    </div>
    
    <div class="uline"></div>
    <div class="hn_i_box ">
        <h1>成功牵线案例<b></b></h1>
        <h5>定制高端猎婚 • 打造一流服务</h5>
        <div class="iMarqueeBox">
        <div id="iMarquee" class="iMarquee">
        <?php 
        $rt = $db->query("SELECT  a.senduid,a.uid,b.sex FROM ".__TBL_QIANXIAN__." a,".__TBL_USER__." b WHERE a.flag=2 AND (b.flag=1 OR b.flag=-2) AND a.senduid=b.id".$agentSQL2." ORDER BY a.id DESC LIMIT 15 ");//,photo_s,photo_f,photo_ifshow
        $total = $db->num_rows($rt);
        if ($total>0){
            for($i=1;$i<=$total;$i++) {
                $rows = $db->fetch_array($rt,'name');
                if(!$rows) break;
                $uid     = $rows['uid'];
                $sex     = $rows['sex'];
				$senduid = $rows['senduid'];
				/*
                $photo_s  = $rows['photo_s'];
                $photo_f  = $rows['photo_f'];
				$photo_ifshow = $rows['photo_ifshow'];
				if($photo_ifshow==0){
					$photo_s_url=RES.'photo_m'.$sex.'_hide.png';
				}else{
					$photo_s_url = (!empty($photo_s) && $photo_f==1)?UP.$photo_s:RES.'photo_s'.$sex.'.png';
				}
				*/
				$photo_s_url = RES.'photo_s'.$sex.'.png';
                //uid
                $row2 = $db->ROW(__TBL_USER__,"sex","id=".$uid,"name");
                if ($row2){
                    $sex2      = $row2['sex'];
					/*
                    $photo_s2  = $row2['photo_s'];
                    $photo_f2  = $row2['photo_f'];
					$photo_ifshow2 = $row2['photo_ifshow'];
					if($photo_ifshow2==0){
						$photo_s_url2=RES.'photo_m'.$sex2.'_hide.png';
					}else{
						$photo_s_url2 = (!empty($photo_s2) && $photo_f2==1)?UP.$photo_s2:RES.'photo_s'.$sex2.'.png';
					}
					*/
					$photo_s_url2 = RES.'photo_s'.$sex2.'.png';
                }else{
					continue;
				}
				$uid     = '*'.substr($uid,1,3).'*'.substr($uid,4,1).'*';
				$senduid = '*'.substr($senduid,1,3).'*'.substr($senduid,4,1).'*';
                echo '<li><font>恭喜会员</font> <img src="'.$photo_s_url2.'"><font>'.$uid.'</font><i class="ico">&#xe635;</i><img src="'.$photo_s_url.'"><font>'.$senduid.'</font> <font>牵线成功</font></li>';
            }
        }else{echo $nodatatips;}
        ?>
        </div></div>
        <div class="clear"></div>
    </div>
    <?php if ($total>0){?>
    <script>
    var zeai_iMarquee = function (id, tag, heigh, speed, delay) {
        var me = this;
        me.EL = document.getElementById(id);
        me.PA = 0;
        me.TI = null;
        me.LH = heigh;
        me.SP = speed;
        me.DY = delay;
        me.exec = function () {
            if (me.PA) return;
            me.EL.scrollTop += 2;
            if (me.EL.scrollTop % me.LH <= 1) {
                clearInterval(me.TI);
                me.EL.appendChild(me.EL.getElementsByTagName(tag)[0]);
                me.EL.scrollTop = 0;
                setTimeout(me.start, me.DY * 1000);
            }
        };
        me.start = function () {if (me.EL.scrollHeight - me.EL.offsetHeight >= me.LH) me.TI = setInterval(me.exec, me.SP);};
        setTimeout(me.start, me.DY * 1000);
    };
    function zeai_iMarqueeFn(){setTimeout(function(){new zeai_iMarquee("iMarquee","li",40,50,1);},100);}setTimeout(function(){zeai_iMarqueeFn();},2000);
    </script>
    <?php }?>
    <div class="uline"></div>
    <div class="hn_i_box ubox">
        <h1>线下优质会员<b></b>
            <h5>优质线下资源 • 高端约会场所</h5>
        </h1>
        <div class="iubtn"><a href="user.php?t=offline&photo_s=1" class="ed">推荐</a><a href="user.php?t=offline&photo_s=1&sex=1">男生</a><a href="user.php?t=offline&photo_s=1&sex=2">女生</a></div>
        <div class="hn_i_u">
            <?php 
			$SQL=$agentSQL;
			if(ifint($cook_uid && !empty($cook_sex)) && $_INDEX['iModuleU']==1 && $cook_ifadm!=1){
				$SQL  .= ($cook_sex==2)?" AND sex=1 ":" AND sex=2 ";
			}
            $rt=$db->query("SELECT id,sex,grade,photo_s,photo_f,RZ,birthday,pay,job,heigh,photo_ifshow,crm_flag FROM ".__TBL_USER__." WHERE flag=1 AND (kind=2 OR kind=3) AND photo_f=1 AND photo_s<>''   ".$SQL." ORDER BY refresh_time DESC,id DESC LIMIT 9"); //AND dataflag=1
            $total = $db->num_rows($rt);
            if ($total > 0) {
                for($i=1;$i<=$total;$i++) {
                    $rows = $db->fetch_array($rt,'name');
                    if(!$rows)break;
                    $echo='';
                    $uid     = $rows['id'];
                    $sex     = $rows['sex'];
                    $grade   = $rows['grade'];
                    $photo_s = $rows['photo_s'];
                    $photo_f = $rows['photo_f'];
                    $heigh   = $rows['heigh'];
                    $age = getage($rows['birthday']);
                    $RZ  = $rows['RZ'];$RZarr = explode(',',$RZ);
                    $pay = $rows['pay'];
                    $photo_ifshow = $rows['photo_ifshow'];
                    $age_str = ($age>18)?$age.'岁':'';
                    if(empty($pay) && empty($age) && empty($heigh)){
                        $ifdata = false;
                    }else{
                        $job_str = (!empty($rows['job']))?udata('job',$rows['job']):udata('pay',$rows['pay']);
                        $heigh_str = udata('heigh',$heigh);
                        $ifdata = true;
                    }
					$photo_m_url  = photo_s_out('{"smb":"m","sex":"'.$sex.'","photo_s":"'.$photo_s.'","photo_f":"'.$photo_f.'","photo_ifshow":"'.$photo_ifshow.'","uflag":"'.$uflag.'","outkind":"url"}');
                    $href='hongniang_u.php?uid='.$uid;
                    $echo .= '<a uid="'.$uid.'" sex="'.$sex.'" href="'.$href.'"><img class="m" src="'.$photo_m_url.'" />';
                    $echo .= '<div class="uinfo">';
                    if($ifdata)$echo.= '<div class="data"><span>'.$age_str.' / '.$heigh_str.'</span><span>'.$job_str.$pay_str.'</span></div>';
                    $echo .= '</div>';
					if(in_array('photo',$RZarr)){
						$echo.= '<img src="'.RES.'m/img/rzj2.png?'.$_ZEAI['cache_str'].'" class="rzj">';
					}elseif(in_array('identity',$RZarr)){
						$echo.= '<img src="'.RES.'m/img/rzj.png?'.$_ZEAI['cache_str'].'" class="rzj">';
					}
                    $echo.= '</a>';
                    if($i % 3 == 0)$echo.= '<div class="clear"></div>';
                    echo $echo;
                }
            }else{echo $nodatatips;}?>
        </div>
        <div class="clear"></div>
        <a href="user.php?t=offline"class="hn_i_more">　更多会员　</a>
        <div class="clear"></div>
    </div>
<?php }
	$kf_tel=dataIO($_ZEAI['kf_tel'],'out');$kf_mob=dataIO($_ZEAI['kf_mob'],'out');
	$tel=(empty($kf_tel))?$kf_mob:$kf_tel;
	?>
    <div id="agent_weixin_ewmBox" class="my-subscribe_box" style="display:none"><img src="<?php echo UP.$kf_wxpic;?>"><h3>长按二维码添加客服微信</h3></div>
    <div class="hn_i_btm">
        <a href="tel:<?php echo $tel;?>"><i class="ico">&#xe7c1;</i><span>幸福热线</span></a>
        <a onClick="ZeaiM.div({obj:agent_weixin_ewmBox,w:26,h:26});"><i class="ico">&#xe784;</i><span>咨询客服</span></a>
        <a href="<?php echo HOST;?>/m/my_hongniang.php?jumpurl=<?php echo $jumpurl;?>"><span class="ico">&#xe613; 我的红娘</span></a>
    </div>

<div class="blank"></div>
<?php
if($_ZEAI['m_mb']==2 && !ifint($hid))echo "<script>setTimeout(function(){hdnavLRmoveFn(hdnav,119,'r');},1);</script>";
require_once ZEAI.'m/TRnav.php';?>
<?php
if (is_weixin()){?>
	<script>
	wx.config({debug:false,appId: '<?php echo $signPackage["appId"];?>',timestamp: <?php echo $signPackage["timestamp"];?>,nonceStr:'<?php echo $signPackage["nonceStr"];?>',signature: '<?php echo $signPackage["signature"];?>',jsApiList:['hideMenuItems','onMenuShareTimeline','onMenuShareAppMessage','onMenuShareQQ','onMenuShareWeibo','previewImage']});
	var FX_title = '<?php echo trimhtml($wxshareT);?>',
	FX_desc  = '<?php echo trimhtml($wxshareC).'【'.$_ZEAI['siteName'].'】';?>',
	FX_link  = '<?php echo $wxshareURL; ?>',
	FX_imgurl= '<?php echo $wxsharePIC; ?>';
	wx.ready(function () {
		wx.onMenuShareAppMessage({title:FX_title,desc:FX_desc,link:FX_link,imgUrl:FX_imgurl});
		wx.onMenuShareTimeline({title:FX_title,link:FX_link,imgUrl:FX_imgurl});
	});
	</script>
<?php }?>
</body>
</html>